﻿using System;
using System.Xml.Serialization;
using System.IO;

namespace BizControl.Library.AI
{
  public class ProcessorBase<T> : IProcess<T>, IXmlSerializable
  {
    #region IProcess<T> Members

    public virtual T Process(T item)
    {
      throw new NotImplementedException();
    }

    public void Save(string filename)
    {
      XmlSerializer serializer = new XmlSerializer(this.GetType());
      if (File.Exists(filename))
      {
        File.Delete(filename);
      }
      using (var fileStream = File.OpenWrite(filename))
      {
        serializer.Serialize(fileStream, this);
      }
    }

    #endregion

    #region IXmlSerializable Members

    public virtual System.Xml.Schema.XmlSchema GetSchema()
    {
      return null;
    }

    public virtual void ReadXml(System.Xml.XmlReader reader)
    {
      throw new NotImplementedException();
    }

    public virtual void WriteXml(System.Xml.XmlWriter writer)
    {
      throw new NotImplementedException();
    }

    #endregion
  }
}
